<template>
  <el-main>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="对账批次">
        <el-input v-model="formInline.checkBatchNo" placeholder="审批人"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column
        prop="checkBatchNo"
        label="对账批次"
        width="180">
      </el-table-column>
      <el-table-column
        prop="businessName"
        label="商户名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="amount"
        label="结算金额">
      </el-table-column>
      <el-table-column
        prop="tradeDateZf"
        label="交易日期">
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="formInline.pageNum"
      :page-sizes="[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
      :page-size="formInline.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="formInline.total">
    </el-pagination>
  </el-main>
</template>

<script>

import { clearList } from "@/api/finance/settleaccounts/settleaccounts";

export default {
  name: "index",
  data() {
    return {
      formInline: {
        checkBatchNo: '',
        pageNum:1,
        size:10,
        total:0
      },
      tableData:[],
    }
  },
  methods: {
    onSubmit() {
      this.list()
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSizeChange(val) {
      this.formInline.size=val;
      console.log(`每页 ${val} 条`);
      this.list()
    },
    handleCurrentChange(val) {
      this.formInline.pageNum=val;
      console.log(`当前页: ${val}`);
      this.list()
    },
    list(){
      clearList(this.formInline).then(res=>{
        console.log(res)
        this.tableData=res.data.list;
        this.formInline.pageNum=res.data.pageNum;
        console.log(res.data.pageNum)
        this.formInline.size=res.data.pageSize;
        console.log(res.data.total)
        this.formInline.total=res.data.total;
      })
    }
  },
  created() {
    this.list()
  }
}
</script>

<style scoped>

</style>
